home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / Snippets / Devices / Audio CD ƒ / cd.h < prev    next >
Encoding:
Text File  |  1992-07-15  |  3.9 KB  |  203 lines  |  [TEXT/MPS ]

  1. // imWare
  2. // Wednesday, February 14, 1990
  3. // James Beninghaus
  4.  
  5. #ifndef __FILES__
  6.     #include    <Files.h>
  7. #endif
  8. #ifndef __DEVICES__
  9.     #include    <Devices.h>
  10. #endif
  11.  
  12. #define csDiscStatus    8
  13. #define csWhoIsThere    97
  14. #define csReadTOC        100
  15. #define csReadQ            101
  16. #define csATrkSearch    103
  17. #define csAPlay            104
  18. #define csAPause        105
  19. #define csAStop            106
  20. #define csAStatus        107
  21. #define csAScan            108
  22.  
  23. #define BLOCKADDR        0
  24. #define    MSFADDR            1
  25. #define TRACKADDR        2
  26.  
  27. #define TOCTRACKS        1
  28. #define TOCENDOFDISK    2
  29. #define TOCSTARTADDR    3
  30.  
  31. #define STEREO            9
  32. #define MONO            15
  33.  
  34. #define START            0
  35. #define STOP            1
  36.  
  37. #define PAUSE            1
  38. #define CONTINUE        0
  39.  
  40. #define    PLAYING            0
  41. #define    PAUSED            1
  42.  
  43. //typedef    unsigned char    Byte;
  44. typedef unsigned short    Word;
  45. typedef    unsigned long    Long;
  46.  
  47. typedef struct WhoIsThereRec {
  48.     ParamBlockHeader
  49.     short        ioRefNum;
  50.     short        csCode;
  51.     struct {
  52.         Byte    fill;
  53.         Byte    SCSIMask;
  54.     } csParam;
  55. } WhoIsThereRec;
  56.  
  57. typedef struct AStatusRec {
  58.     ParamBlockHeader
  59.     short        ioRefNum;
  60.     short        csCode;
  61.     struct {
  62.         Byte    audioStatus;
  63.         Byte    playMode;
  64.         Byte    cntlField;
  65.         Byte    minutes;
  66.         Byte    seconds;
  67.         Byte    frames;
  68.     } csParam;
  69. } AStatusRec;
  70.  
  71. typedef struct {
  72.     Byte        cntlField;
  73.     Byte        minutes;
  74.     Byte        seconds;
  75.     Byte        frames;
  76. } StartAddrRec;
  77.  
  78. typedef struct ReadTOCRec {
  79.     ParamBlockHeader
  80.     short        ioRefNum;
  81.     short        csCode;
  82.     union {
  83.         Word    type;
  84.         Byte    addr[3];
  85.         struct {
  86.             Word    fill;
  87.             Long    data;
  88.             Word    length;
  89.             Byte    track;
  90.         } buffer;
  91.     } csParam;
  92. } ReadTOCRec;
  93.  
  94. typedef struct APlayRec {
  95.     ParamBlockHeader
  96.     short        ioRefNum;
  97.     short        csCode;
  98.     struct {
  99.         Word    type;
  100.         Byte    addr[4];
  101.         Word    startStop;
  102.         Byte    fill;
  103.         Byte    playMode;
  104.     } csParam;
  105. } APlayRec;
  106.  
  107. typedef struct ATrkSearchRec {
  108.     ParamBlockHeader
  109.     short        ioRefNum;
  110.     short        csCode;
  111.     struct {
  112.         Word    type;
  113.         Byte    addr[4];
  114.         Word    playFlag;
  115.         Byte    fill;
  116.         Byte    playMode;
  117.     } csParam;
  118. } ATrkSearchRec;
  119.  
  120. typedef struct AStopRec {
  121.     ParamBlockHeader
  122.     short        ioRefNum;
  123.     short        csCode;
  124.     struct {
  125.         Word    type;
  126.         Byte    addr[4];
  127.     } csParam;
  128. } AStopRec;
  129.  
  130. typedef struct APauseRec {
  131.     ParamBlockHeader
  132.     short        ioRefNum;
  133.     short        csCode;
  134.     struct {
  135.         Long    state;
  136.     } csParam;
  137. } APauseRec;
  138.  
  139. typedef struct DiscStatusRec {
  140.     ParamBlockHeader
  141.     short        ioRefNum;
  142.     short        csCode;
  143.     struct {
  144.         Word    track;
  145.         Byte    writeProtect;
  146.         Byte    discInPlace;
  147.         Byte    installed;
  148.         Byte    side;
  149.         Long    qLink;
  150.         Word    qType;
  151.         Word    dQDrive;
  152.         Word    dQRefNum;
  153.         Word    dQFSID;
  154.         Byte    twoSideFormat;
  155.         Byte    needsFlush;
  156.         Byte    diskErrs;
  157.     } csParam;
  158. } DiscStatusRec;
  159.  
  160. typedef struct ReadQRec {
  161.     ParamBlockHeader
  162.     short        ioRefNum;
  163.     short        csCode;
  164.     struct {
  165.         Byte    cntlField;
  166.         Byte    track;
  167.         Byte    index;
  168.         Byte    trackMinutes;
  169.         Byte    trackSeconds;
  170.         Byte    trackFrames;
  171.         Byte    discMinutes;
  172.         Byte    discSeconds;
  173.         Byte    discFrames;
  174.     } csParam;
  175. } ReadQRec;
  176.  
  177. typedef struct AScanRec {
  178.     ParamBlockHeader
  179.     short        ioRefNum;
  180.     short        csCode;
  181.     struct {
  182.         Word    type;
  183.         Byte    addr[4];
  184.         Word    direction;
  185.     } csParam;
  186. } AScanRec;
  187.  
  188. void            Usage        (void);
  189. pascal    Byte    Decimal2BCD    (Byte n);
  190. pascal    Byte    BCD2Decimal    (Byte n);
  191. pascal    OSErr    EjectCD        (short ioRefNum);
  192. pascal    OSErr    OpenCD        (Byte CDDrive, short *ioRefNum);
  193. pascal    OSErr    APlay        (short ioRefNum, Byte startTrack, Byte playMode);
  194. pascal    OSErr    AScan        (short ioRefNum, Byte minutes, Byte seconds, Byte frames, Byte direction);
  195. pascal    OSErr    APause        (short ioRefNum, Long state);
  196. pascal    OSErr    AStop        (short ioRefNum, Byte stopTrack);
  197. pascal    OSErr    ATrkSearch    (short ioRefNum, Byte track, Byte playFlag, Byte playMode);
  198. pascal    OSErr    AStatus        (short ioRefNum, Byte *audioStatus, Byte *playMode, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
  199. pascal    OSErr    TrackCount    (short ioRefNum, Byte *lastTrack);
  200. pascal    OSErr    TrackInfo    (short ioRefNum, Byte track, Byte *cntlField, Byte *minutes, Byte *seconds, Byte *frames);
  201. pascal    OSErr    DiscStatus    (short ioRefNum, Boolean *discInPlace);
  202. pascal    OSErr    ReadQ        (short ioRefNum, Byte *cntlField, Byte *track, Byte *index, Byte *trackMinutes, Byte *trackSeconds, Byte *trackFrames, Byte *discMinutes, Byte *discSeconds, Byte *discFrames);
  203.